package com.example.finaltool.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.finaltool.model.db.CmmFunctionExtConfig;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author dengbw
 */
@Mapper
public interface CmmFunctionExtConfigMapper extends BaseMapper<CmmFunctionExtConfig> {

    @Insert("INSERT INTO `cmm_function_ext_config`(`id`, `name`, `type`, `url`, `tenant_id`, `platform`, `sub_tenant_id`) VALUES (#{id},#{name}, #{type}, #{url}, #{corpId}, #{platform}, #{sub})")
    void save(Long id, String name, Integer type, String url, String corpId, Integer platform, Long sub);

    @Select("SELECT DISTINCT c.id FROM cmm_function_ext_config c  WHERE c.tenant_id = #{corpId} and c.sub_tenant_id = #{subId}")
    List<Long> queryExistIds(String corpId, Long subId);
}
